<header class="blog-header">
    <div class="header-container">
        <div class="header-brand">
            <a href="{{ url_for('posts.index') }}" class="logo-link">
                <h1>{% block header_title %}晨光博客{% endblock %}</h1>
            </a>
            <button class="mobile-menu-toggle" aria-label="Toggle menu">
                <i class="fas fa-bars"></i>
            </button>
        </div>

        <div class="header-content">
            <div class="search-container">
                <form id="search-form" action="{{ url_for('posts.search') }}" method="GET">
                    <div class="search-box">
                        <input type="text" name="q" placeholder="搜索文章..." autocomplete="off"
                               value="{{ request.args.get('q', '') }}">
                        <button type="submit" aria-label="Search">
                            <i class="fas fa-search"></i>
                        </button>
                    </div>
                </form>
            </div>

            <nav class="main-nav">
                <ul class="nav-list">
                    <li class="nav-item">
                        <a href="{{ url_for('posts.index') }}" class="nav-link">
                            <i class="fas fa-home"></i> 首页
                        </a>
                    </li>
                    {% if session.get('logged_in') %}
                        <li class="nav-item">
                            <a href="{{ url_for('admin.admin') }}" class="nav-link">
                                <i class="fas fa-user-shield"></i> 管理
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="{{ url_for('auth.admin_logout') }}" class="nav-link">
                                <i class="fas fa-sign-out-alt"></i> 登出
                            </a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a href="{{ url_for('auth.admin_login') }}" class="nav-link">
                                <i class="fas fa-sign-in-alt"></i> 登录
                            </a>
                        </li>
                    {% endif %}
                    <li class="theme-switcher">
                        <button id="theme-toggle" class="nav-link" style="background-color: #0071e3">
                            <i class="fas fa-moon"></i> 切换主题
                        </button>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>